/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.gov.ana.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author lucas.nunes
 */
@Entity
@Table(name = "QLTTB_TIPO_MEIO_TRANSMISSAO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TipoMeioTransmissao.findAll", query = "SELECT t FROM TipoMeioTransmissao t"),
    @NamedQuery(name = "TipoMeioTransmissao.findByTmtId", query = "SELECT t FROM TipoMeioTransmissao t WHERE t.tmtId = :tmtId"),
    @NamedQuery(name = "TipoMeioTransmissao.findByTmtNm", query = "SELECT t FROM TipoMeioTransmissao t WHERE t.tmtNm = :tmtNm"),
    @NamedQuery(name = "TipoMeioTransmissao.findByTmtDs", query = "SELECT t FROM TipoMeioTransmissao t WHERE t.tmtDs = :tmtDs")})
public class TipoMeioTransmissao implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "TMT_ID")
    private BigDecimal tmtId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 104)
    @Column(name = "TMT_NM")
    private String tmtNm;
    @Size(max = 4000)
    @Column(name = "TMT_DS")
    private String tmtDs;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "metTmtId")
    private List<MeioTransmissao> meioTransmissaoList;
    @JoinColumn(name = "TMT_QMT_ID", referencedColumnName = "QMT_ID")
    @ManyToOne(optional = false)
    private QualifMeioTransmissao tmtQmtId;

    public TipoMeioTransmissao() {
    }

    public TipoMeioTransmissao(BigDecimal tmtId) {
        this.tmtId = tmtId;
    }

    public TipoMeioTransmissao(BigDecimal tmtId, String tmtNm) {
        this.tmtId = tmtId;
        this.tmtNm = tmtNm;
    }

    public BigDecimal getTmtId() {
        return tmtId;
    }

    public void setTmtId(BigDecimal tmtId) {
        this.tmtId = tmtId;
    }

    public String getTmtNm() {
        return tmtNm;
    }

    public void setTmtNm(String tmtNm) {
        this.tmtNm = tmtNm;
    }

    public String getTmtDs() {
        return tmtDs;
    }

    public void setTmtDs(String tmtDs) {
        this.tmtDs = tmtDs;
    }

    @XmlTransient
    public List<MeioTransmissao> getMeioTransmissaoList() {
        return meioTransmissaoList;
    }

    public void setMeioTransmissaoList(List<MeioTransmissao> meioTransmissaoList) {
        this.meioTransmissaoList = meioTransmissaoList;
    }

    public QualifMeioTransmissao getTmtQmtId() {
        return tmtQmtId;
    }

    public void setTmtQmtId(QualifMeioTransmissao tmtQmtId) {
        this.tmtQmtId = tmtQmtId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tmtId != null ? tmtId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoMeioTransmissao)) {
            return false;
        }
        TipoMeioTransmissao other = (TipoMeioTransmissao) object;
        if ((this.tmtId == null && other.tmtId != null) || (this.tmtId != null && !this.tmtId.equals(other.tmtId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.gov.ana.service.TipoMeioTransmissao[ tmtId=" + tmtId + " ]";
    }
    
}
